<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:fn="http://java.sun.com/jsp/jstl/functions"
                xmlns:ds="http://deltaset.org/deltaset-faces"
                xmlns:meta="http://deltaset.org/deltaset-meta"
                xmlns:mf="http://java.sun.com/jsf/composite/deltaset.meta/flow"
                xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface>
        <composite:attribute name="renderBackButton" type="java.lang.Boolean" default="true"/>
    </composite:interface>

    <composite:implementation>	   
        <c:set var="flowFormId" value="#{cc.clientId}:flow-form"/>
        <h:form  id="flow-form">           
            <ds:titlebar title="#{metaBean.labelEntity}" style="margin-bottom: 5px;">
                <div style="display:block">
                    <h:commandLink  value="Back"
                                    disabled="#{metaBean.disabledPreviousView}"
                                    rendered="#{cc.attrs.renderBackButton}"  
                                    immediate="true"
                                    style="font-size: 0.8em;margin-right: 5px;">
                        <f:ajax execute="@form" render="@form"/>
                        <f:param name="deltaset.meta.previousView" value="true"/>
                    </h:commandLink>
                    <h:commandLink  value="View All">
                        <f:ajax event="click" render="@form"/> 
                        <f:param name="deltaset.meta.entityClassName" value="#{metaBean.modelClassName}"/>
                        <f:param name="deltaset.meta.viewName" value="listTemplate"/>
                    </h:commandLink>
                    <h:panelGroup rendered="#{empty meta.executor}" layout="block">
                        <c:forEach items="#{metaBean.factoryActions}" var="action">
                            <mf:commandButton metaAction="#{action}"
                                              model="#{metaBean.model}"
                                              meta="#{metaBean}"                                          
                                              />
                        </c:forEach>

                        <c:forEach items="#{metaBean.otherActions}" var="action">
                            <mf:commandButton metaAction="#{action}"
                                              model="#{metaBean.model}"
                                              meta="#{metaBean}"                                         
                                              style="font-size: 0.8em;"
                                              />
                        </c:forEach>
                    </h:panelGroup>
                </div>
            </ds:titlebar>
            <ui:include src="#{metaBean.currentViewTemplate}">
                <ui:param name="meta" value="#{metaBean}"/>
                <ui:param name="formId" value="#{flowFormId}"/>
            </ui:include>
        </h:form>	
    </composite:implementation>

</ui:composition>
